from typing import List


class Solution:
    def getRow(self, rowIndex: int) -> List[int]:
        preRow = [1]
        for i in range(1, rowIndex + 1):
            curRow = []
            for j in range(0, i + 1):
                a = preRow[j - 1] if j > 0 else 0
                b = preRow[j] if j < len(preRow) else 0
                curRow.append(a + b)
            preRow = curRow
        return preRow